package com.string.test;

import java.util.Scanner;

public class IdCard {
    public static void main(String[] args) {
        String id;
        while (true) {
            System.out.println("请输入您的身份证号码：");
            Scanner sc = new Scanner(System.in);
            id = sc.next();
            if (id.length()==18)break;
            else System.out.println("输入错误，请重新输入：");
        }
        String year=id.substring(6,10);
        String month=id.substring(10,12);
        String day=id.substring(12,14);
        System.out.println("人物信息为：");
        System.out.println("出生年月日为："+year+"年"+month+"月"+day+"日");
        char gender=id.charAt(16);
        int real_gender=gender-48;
        if (real_gender%2!=0){
            System.out.println("性别为：男");;
        }else System.out.println("性别为：女" );




    }
}
